<template>
	<view class="mainpadding2">
		<view class="flexcenter" v-if="!list.data.length">
			<view class="placeholderimage" style="margin-top: 300rpx;" ></view>
		</view>
		<view class="margin_top xiahuaxian" v-for="item in list.data" :key="item.id">
			<view class="flexbetween">
				<view class="flexleft">
					<view class="touxiang margin_right2">
						<image :src="item.user.avatar_text" mode=""></image>
					</view>
					<view class="">
						<view class="ershiba xiaohei nofonweight">{{item.username}}</view>
						<view class="strongtext xiaohui nofonweight margin_top1">性别：{{item.gender==0?"未知":item.gender==1?'男':'女'}}</view>
					</view>
				</view>
				<view class="strongtext xiaohui nofonweight margin_top1" v-if="type==2">{{item.activity.type==1?'个人赛':'团队赛'}}</view>
				<view class="strongtext xiaohui nofonweight margin_top1" v-if="type==1">{{item.ss.type==1?'个人赛':'团队赛'}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")

	export default {
		data() {
			return {
				listid: "",
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				type:1,//1赛事包名列表，2活动包名列表
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.type = options.type
			this.init()
		},
		methods: {
			init(isPage, page) {
				let _this = this;
				let data = {
					page: page || 1,
					limit: _this.limit,
					ss_id: this.listid,
				}
				let url = '/api/sscl/ssBmIndex'
				if(this.type==2){//活动报名列表
					url = '/api/Activitycl/activityBmIndex'
					delete data.ss_id
					this.$set(data,"activity_id",this.listid)
				}
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style lang="scss" scoped>
	.touxiang {
		width: 80rpx;
		height: 80rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}
</style>